﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using Resto.CostControl.Core.Models;

namespace Resto.CostControl.Core
{
    /// <summary>
    /// 原材料加工单
    /// </summary>
    public class MaterialProcess : BaseModel
    {
        public MaterialProcess()
        {
            ItemDesc = string.Empty;
        }

        public string Id { get; set; }

        [Display(Name = "加工单编号")]
        public string Code { get; set; }

        [Display(Name = "加工日期")]
        public DateTime ProcessDate { get; set; }

        [Display(Name = "状态")]
        public string OrderState { get; set; }

        [Display(Name = "加工总克重")]
        public decimal TotalWeight { get; set; }

        [Display(Name = "备注")]
        public string Remark { get; set; }

        [Display(Name = "品名汇总")]
        public string ItemDesc { get; set; }

        [Display(Name = "品名大类")]
        public string Category { get; set; }

        public IList<MaterialProcessItem> Items { get; set; }
    }

    public class MaterialProcessItem
    {
        public string Id { get; set; }

        /// <summary>
        /// 订单Id
        /// </summary>
        public string OrderId { get; set; }

        [Display(Name = "品名Id")]
        public string MaterialId { get; set; }

        [Display(Name = "品名编号")]
        public string Code { get; set; }

        [Display(Name = "品名名称")]
        public string Name { get; set; }

        /// <summary>
        /// 半成品所对应的原材料Id
        /// </summary>
        [Display(Name = "所需原材料")]
        public string RawMaterialId { get; set; }

        /// <summary>
        /// 半成品所对应的原材料名称
        /// </summary>
        [Display(Name = "所需原材料")]
        [NotMapped]
        public string RawMaterialName { get; set; }

        [Display(Name = "品名大类")]
        public string Category { get; set; }

        [Display(Name = "加工数")]
        public decimal ProcessCount { get; set; }

        [Display(Name = "期望领料数")]
        public decimal ExpectedPickCount { get; set; }

        [Display(Name = "实际领料数")]
        public decimal ActualPickCount { get; set; }

        [Display(Name = "期望入库数")]
        public decimal ExpectedStorageCount { get; set; }

        [Display(Name = "实际入库数")]
        public decimal ActualStorageCount { get; set; }

        [Display(Name = "状态")]
        public string State { get; set; }
    }
}
